From: Jasper St. Pierre Date: Tue, 28 Jan 2014 16:06:21 +0000 (-0500) Subject: appDisplay: Only reload frequently used data when mapping the frequent view X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~2868 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=bdad4db9ec4e08f2376144253f883dc060e14a3f;p=gnome-shell.git appDisplay: Only reload frequently used data when mapping the frequent view If the user mostly uses the All Apps view and uses it as his default view, we shouldn't reload frequent data after a timeout. Simply do it when the view is mapped. https://bugzilla.gnome.org/show_bug.cgi?id=723179 --- diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 921d83b07..21cf56be6 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -561,17 +561,18 @@ const FrequentView = new Lang.Class({ this._noFrequentAppsLabel.hide(); this._usage = Shell.AppUsage.get_default(); + + this.actor.connect('notify::mapped', Lang.bind(this, function() { + if (this.actor.mapped) + this._redisplay(); + })); }, hasUsefulData: function() { return this._usage.get_most_used("").length >= MIN_FREQUENT_APPS_COUNT; }, - removeAll: function() { - this._grid.destroyAll(); - }, - - loadApps: function() { + _loadApps: function() { let mostUsed = this._usage.get_most_used (""); let hasUsefulData = this.hasUsefulData(); this._noFrequentAppsLabel.visible = !hasUsefulData; @@ -586,6 +587,11 @@ const FrequentView = new Lang.Class({ } }, + _redisplay: function() { + this.removeAll(); + this._loadApps(); + }, + // Called before allocation to calculate dynamic spacing adaptToSize: function(width, height) { let box = new Clutter.ActorBox(); @@ -652,9 +658,6 @@ const AppDisplay = new Lang.Class({ Shell.AppSystem.get_default().connect('installed-changed', Lang.bind(this, function() { Main.queueDeferredWork(this._allAppsWorkId); })); - Main.overview.connect('showing', Lang.bind(this, function() { - Main.queueDeferredWork(this._frequentAppsWorkId); - })); this._folderSettings = new Gio.Settings({ schema: 'org.gnome.desktop.app-folders' }); this._folderSettings.connect('changed::folder-children', Lang.bind(this, function() { Main.queueDeferredWork(this._allAppsWorkId); @@ -720,7 +723,6 @@ const AppDisplay = new Lang.Class({ this._viewStack.add_actor(this._focusDummy); this._allAppsWorkId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._redisplayAllApps)); - this._frequentAppsWorkId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._redisplayFrequentApps)); }, _showView: function(activeIndex) { @@ -754,13 +756,6 @@ const AppDisplay = new Lang.Class({ this._showView(Views.ALL); }, - _redisplayFrequentApps: function() { - let view = this._views[Views.FREQUENT].view; - - view.removeAll(); - view.loadApps(); - }, - _redisplayAllApps: function() { let view = this._views[Views.ALL].view; view.removeAll();